<!-- (废弃) 确认支付凭证 -->
<div class="float-confirm js_confirmPayoffDiv" style="z-index: 20000;display: none; width:auto;">
    <div class="float-confirm-con">
        <p style="font-size:18px;color:#23a18b;">确认支付凭证</p>
        <div style="width:auto;height:1px;background:#CCC;margin-bottom:20px;"></div>
        <div style="width:500px;height:auto;margin-bottom:15px;">
            <table style="line-height:50px;" class="js_payoffTable">
                <tr>
                    <td><span style="color:red;">*</span>付款户名：</td>
                    <td style="min-width:400px;">
                        <input type="text" class="search-f-ipt1 js_payoffPerson" name="payoff_person" value="">
                    </td>
                </tr>
                <tr>
                    <td><span style="color:red;">*</span>付款金额：</td>
                    <td style="min-width:400px;">
                        <input type="text" class="search-f-ipt1 js_payoffMoney" name="payoff_money" value="">
                    </td>
                </tr>
                <tr>
                    <td><p><span style="color:red;">*</span>付款时间：</p>
                        <p>&nbsp;</p></td>
                    <td style="min-width:400px;">
                        <p><input id="payoffDate" type="text" class="search-f-ipt1 js_payoffTime" name="payoff_time"
                                  value=""></p>
                        <p><span style="color:red;">*填写付款时间,如: '2016-06-11' 或 '2016-06-22 08:09:33'</span></p>
                    </td>
                </tr>
                <tr>
                    <td>备注：</td>
                    <td style="min-width:400px;">
                        <textarea name="payoff_extra" class="add-f-area textarea_box js_payoffExtra"></textarea>
                    </td>
                </tr>
            </table>
        </div>
        <div style="width:auto;height:1px;background:#CCC;margin-bottom:20px;"></div>
        <div class="float-confirm-btns" style="padding-bottom:30px;">
            <a id="js_confirmPayoffBtn" class="btn btn-success btn-sm left" href="javascript:void(0);">确定</a>
            <a class="btn btn-default btn-sm left js_cancel" href="javascript:void(0);">取消</a>
        </div>
    </div>
</div>
<script>
    (function ($) {

        // 确认支付凭证
        $('#js_confirmPayoffBtn').click(function () {
            var id = $('.js_confirmPayoffDiv').data('id');
            var payoff_person = $.trim($('input[name="payoff_person"]').val());
            var payoff_money = $.trim($('input[name="payoff_money"]').val());
            var payoff_time = $.trim($('input[name="payoff_time"]').val());
            var payoff_extra = $.trim($('textarea[name="payoff_extra"]').val());

            if (!payoff_person || !payoff_time || payoff_time == '0000-00-00' || payoff_time == '0000-00-00 00:00:00' || !payoff_money) {
                showMsg('支付凭证信息不完整');
                return false;
            }
            {literal}
            var reg = /^\d{4}-\d{2}-\d{2}( \d{2}(:\d{2}(:\d{2})?)?)?$/;
            {/literal}

            if (!reg.test(payoff_time)) {
                showMsg('日期格式不正确');
                return false;
            }

            if (isNaN(payoff_money)) {
                showMsg('付款金额格式不正确');
                return false;
            }

            showMask('正在提交中...', 1);

            $.ajax({
                url: "{AnUrl('order/admin/create_payoff')}",
                data: {
                    id: id,
                    payoff_person: payoff_person,
                    payoff_money: payoff_money,
                    payoff_time: payoff_time,
                    payoff_extra: payoff_extra
                },
                success: function (res) {
                    if (res.info == 'ok') {
                        location.href = location.href;
                    } else {
                        showMsg(res.info);
                    }
                },
                type: 'post',
                dataType: 'json',
                async: false
            });

        });

        //触发显示支付凭证事件
        $('.js_confirmPayoff').click(function () {
            var order_id = $(this).closest('tr').data('id');
            showConfirmDiv($('.js_confirmPayoffDiv'), order_id);
            var payoff_person = $(this).attr('payoff-person');
            var payoff_money = $(this).attr('payoff-money');
            var payoff_time = $(this).attr('payoff-time');
            var payoff_extra = $(this).attr('payoff-extra');
            if (payoff_time == '0000-00-00 00:00:00' || payoff_time == '0000-00-00') {
                payoff_time = '';
            }

            $('input[name="payoff_person"]').val(payoff_person);
            $('input[name="payoff_money"]').val(payoff_money);
            $('input[name="payoff_time"]').val(payoff_time);
            $('textarea[name="payoff_extra"]').val(payoff_extra);
        });
    })(jQuery);
</script>
<!-- /(废弃) 确认支付凭证 -->